package dao;

import entity.MeetRoom;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

public class GetMeetRoomInfo {
    public static ArrayList<MeetRoom> getMeetingRoom(String administrator){
        ArrayList<MeetRoom> res=new ArrayList<>();
        String sql="select id,name,introduce,position,status,administrator from meetroom where administrator=?";
        try {
            Connection conn=DataBaseConnect.getConnection();
            PreparedStatement pstmt=conn.prepareStatement(sql);
            pstmt.setString(1,administrator);
            ResultSet rs=pstmt.executeQuery();
            while (rs.next()){
                res.add(new MeetRoom(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6)));
            }
        }catch (Exception e){
            System.out.println("获取会议信息error");
            e.printStackTrace();
        }
        return res;
    }
}
